-
-
Notifications
You must be signed in to change notification settings - Fork 192
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for testing emails sent from Drupal #392
Conversation
There's a lot of helper functions in the MailContext. It's possible that these should be split out into a RawMailContext in order to make it easier for people to override the mail steps in their own projects. |
This is looking great! Thanks for working on this. I agree that any non-step-definition code in |
This is also a good idea! Can we maybe split this off to a separate PR? |
Suggested changes by @jhestrom and @pfrenssen made. Tests are failing because this is blocked on the hunk split out into #396 and the supporting driver methods in jhedstrom/DrupalDriver#134. |
Generic scenario hooks run after tagged ones, and so were undoing their effect. The solution is to test for the presence of the tag in the generic hook.
5979efa
to
5413e26
Compare
Thanks for this! |
Addresses #195.
Depends on parallel driver PR134: jhedstrom/DrupalDriver#134.
A few architectural notes ...
Service architecture
I had in mind the possibility that there could be fundamentally different mechanisms for handling test emails (e.g. Drupal core's test mail collector, contrib maillog, and IMAP) which could use the same context. Therefore I tried to put interacting with the mail store outside of the context as a service. The supplied implementation uses test mail collector.
However, I'm not clear yet on how do this in the Drupal extension and so it's not a real service for now, just a kind of service-like class. Hopefully though it will be relatively easy to upgrade to a real service in the future.
Abstracting in this way is responsible for a few minor complications that have no purpose in the default implementation such as
Mink context
I needed to be able to visit pages in order to follow links from emails, but the context is extending RawDrupalContext not RawMinkContext. Therefore I moved getcontext() out of SubContextBase into it's parent RawDrupalContext and used this to help me load a minkContext and visit a page. Maybe there was an easier way of doing this.